import { requestCreater, serverCreater } from './request'

/**
 * 欠费列表
 */
export const getArrearsList = requestCreater('/manage/lawyer/arrears', 'get')

/**
 * 获取摘要
 */
export const getArrearsSummary = requestCreater('/manage/lawyer/arrears/summary', 'get')

/**
 * 诉讼管理curd
 */
export const litServer = serverCreater('/manage/lawyer/lit')

/**
 * 生成起诉状
 */
export const createSue = requestCreater('/manage/lawyer/arrears/sue', 'post')

/**
 * 收回欠费/结案
 */
export const arrearsBackServer = requestCreater('/manage/lawyer/arrears/back', 'post')



/** 
 * 导入欠费数据
 */
export const importArrearsData = (data) => {
  const formData = new FormData();
  formData.append('file', data.file);
  const query = 'company_id=' + data.company_id + '&community_id=' + data.community_id;
  return requestCreater('/manage/lawyer/arrears/import?' + query, 'POST', {
    headers: {
      'Content-Type': 'multipart/form-data',
    },
  })(formData)
}

/** 
 * 导入修改后的欠费数据
 */
export const importUpdateArrearsData = (data) => {
  const formData = new FormData();
  formData.append('file', data.file);
  const query = 'company_id=' + data.company_id + '&community_id=' + data.community_id;
  return requestCreater('/manage/lawyer/arrears/import/update?' + query, 'POST', {
    headers: {
      'Content-Type': 'multipart/form-data',
    },
  })(formData)
}

// 检查导入的数据
export const checkImport = (data) => {
  const formData = new FormData();
  formData.append('file', data.file);
  return requestCreater('/manage/lawyer/arrears/import/check', 'POST', {
    headers: {
      'Content-Type': 'multipart/form-data',
    },
  })(formData)
}

/**
 * 导出欠费数据
 */
export const exportArrearsData = requestCreater('/manage/lawyer/arrears/export', 'get')
// 案件文书------------------------

/**
 * 案件文书curd
 */
export const caseDocumentServer = serverCreater('/manage/lawyer/arrears/document')

// 上传案件文书
export const uploadCaseDocument = (data) => {
  const formData = new FormData();
  formData.append('file', data.file);
  const query = 'arrears_data_id=' + data.arrears_data_id;
  return requestCreater('/manage/lawyer/arrears/document?' + query, 'POST', {
    headers: {
      'Content-Type': 'multipart/form-data',
    },
  })(formData)
}

// 转诉讼/撤销诉讼
export const triggerLitigation = requestCreater('/manage/lawyer/arrears/litigation', 'post')


// 批量发送------------------------------------

/**
 * 批量分配数据
 */
export const batchAssignArrears = requestCreater('/manage/lawyer/arrears/batch/assign', 'post')


/**
 * 查询短信模版
 */
export const getSmsTemplate = requestCreater('/manage/lawyer/arrears/sms/template', 'get')


/**
 * 批量发送短信
 */
export const batchSendSms = requestCreater('/manage/lawyer/arrears/batch/sms', 'post')


/**
 * 获取律师函模版
 */
export const getLetterTemplate = requestCreater('/manage/lawyer/arrears/letter/template', 'get')

/**
 * 批量生成律师函
 */
export const batchCreateLetter = requestCreater('/manage/lawyer/arrears/batch/letter', 'post')


/** 
 * 获取起诉状模版
 */
export const getSueTemplate = requestCreater('/manage/lawyer/arrears/sue/template', 'get')



/**
* 跟进记录curd
*/
export const arrearsTraceServer = serverCreater('/manage/lawyer/arrears/trace')


/**
* 欠费减免
*/
export const arrearsDdiscount = requestCreater('/manage/lawyer/arrears/discount', 'post')

/**
* 撤销/取消撤销
*/
export const triggerArrearsClosed = requestCreater('/manage/lawyer/arrears/closed', 'post')
